package com.knight.jdk8.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * @Description:
 * @author: knight
 * @Date: 2019-05-03 20:48
 */
public class StreamTest5 {
    public static void main(String[] args) {
        // 集合的元素转换成大写输出
        List<String> strings = Arrays.asList("hello", "world", "hello world", "test");
        strings.stream().map(String::toUpperCase).forEach(System.out::println);

        System.out.println("--------------------");
        // 将集合进行打平输出
        Stream<List<Integer>> streamList = Stream.of(Arrays.asList(1),Arrays.asList(2,3),Arrays.asList(4,5,6));
        streamList.flatMap(items->items.stream()).map(item->item * item).forEach(System.out::println);

    }
}